package com.bw.merchant.page

import android.graphics.Color
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.fragment.app.Fragment
import com.alibaba.android.arouter.facade.annotation.Route
import com.bw.base.path.RouterPath
import com.bw.common.view.BaseMvvmActivity
import com.bw.merchant.R
import com.bw.merchant.databinding.ActivityApprovalBinding
import com.bw.merchant.page.fragment.ConfirmedFragment
import com.bw.merchant.page.fragment.SettledFragment
import com.bw.merchant.page.fragment.TobeConfirmedFragment
import dagger.hilt.android.AndroidEntryPoint

/**
 * 入驻审批页面
 */
@Route(path = RouterPath.PATH_APPROVAL_PATH)
@AndroidEntryPoint
class ApprovalActivity : BaseMvvmActivity<ActivityApprovalBinding>() {


    override fun getLayoutId(): Int = R.layout.activity_approval

    override fun initViews() {
        super.initViews()
        mDataBinding.approvalBack.setOnClickListener {
            finish()
        }

        //默认是入驻申请页面
        replaceFragment(TobeConfirmedFragment())

        mDataBinding.approvalApproveFalse.setOnClickListener {
            mDataBinding.approvalApproveTrue.setTextColor(Color.parseColor("#000000"))
            mDataBinding.approvalApproveTrueInd.setBackgroundResource(R.drawable.ind_unselect)


            mDataBinding.approvalApproveFalse.setTextColor(Color.parseColor("#007660"))
            mDataBinding.approvalApproveFalseInd.setBackgroundResource(R.drawable.ind_select)
            replaceFragment(TobeConfirmedFragment())
        }

        mDataBinding.approvalApproveTrue.setOnClickListener {
            mDataBinding.approvalApproveTrue.setTextColor(Color.parseColor("#007660"))
            mDataBinding.approvalApproveTrueInd.setBackgroundResource(R.drawable.ind_select)


            mDataBinding.approvalApproveFalse.setTextColor(Color.parseColor("#000000"))
            mDataBinding.approvalApproveFalseInd.setBackgroundResource(R.drawable.ind_unselect)
            replaceFragment(ConfirmedFragment())
        }
    }
    private fun replaceFragment(fragment: Fragment) {
        supportFragmentManager.beginTransaction()
            .replace(R.id.approvalFragment, fragment)
            .commit()
    }


}